package cn.iocoder.yudao.module.shop.category.pojo.vo;

import cn.iocoder.yudao.framework.util.TreeUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nonnull;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Schema(description = "管理后台 - 行业类目 Response VO")
@Data
public class TreeShopCategoryRespVO extends ShopCategorySimpleRespVO implements TreeUtils.TreeNode<Long, TreeShopCategoryRespVO> {

    @Schema(description = "父分类名称", example = "普通产品")
    private String parentName;

    private final List<TreeShopCategoryRespVO> children = new ArrayList<>();

    @Override
    public String getParentName() {
        return parentName;
    }

    @Override
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    @Nonnull
    @Override
    public List<TreeShopCategoryRespVO> getChildren() {
        return children;
    }

    @Override
    public int compareTo(TreeShopCategoryRespVO o) {
        return this.getSort().compareTo(o.getSort());
    }

}
